#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int r=n;
	vector<int> f;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='0')
			continue;
		int j=i;
		while(j<n && s[j]=='1')
		{
			j++;
		}
		
		int c=j-i;
		int d=(c-1)/2;
		if(i==0 || j==n)
		{
			d=c-1;
		}
		r=min(d,r);
		f.push_back(c);
		i=j;
			
	}
	int ret=0;
	for(auto& e:f)
	{
		//e/(2*r+1)
		ret+=(e+2*r)/(2*r+1);
	}
	cout<<ret<<endl;
	return 0;
}

//2*r+1<=c
